﻿
using BaseInfo;
using Bridge.Shared.Extensions;
using Microsoft.EntityFrameworkCore;
using Stock;
using System.Security.Cryptography.Pkcs;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Vouchers;


[ConnectionStringName("Default")]
public class WmsDbContext : BridgeDbContext<WmsDbContext>, IWmsDbContext
{
    public static string TablePrefix { get; set; } = "";

    public static string Schema { get; set; }



    public WmsDbContext(DbContextOptions<WmsDbContext> options)
        : base(options)
    {

    }
    #region 基础资料
    public DbSet<AgencyProduct> agencyProducts { get; set; }
    public DbSet<Dept> depts { get; set; }
    public DbSet<DeptProduct> deptsProducts { get; set; }
    public DbSet<Manufacturer> manufacturers { get; set; }

    public DbSet<ProductClass> productClasses { get; set; }
    public DbSet<Supplier> suppliers { get; set; }

    #endregion

    #region 库存实体
    public DbSet<FlowStock> flowStocks { get; set; }
    public DbSet<LockStock> lockStocks { get; set; }
    public DbSet<ProductTrackStock> productTrackStocks { get; set; }

    #endregion

    #region  单据实体

    public DbSet<AllotVoucher> allotVouchers { get; set; }
    public DbSet<AllotVoucherDetail> allotVoucherDetails { get; set; }  

    public DbSet<ConsumeVoucher> consumeVouchers { get; set; }

    public DbSet<ConsumeVoucherDetail> consumeVoucherDetails { get; set; }

    public  DbSet<InStockVoucher> inStockVouchers { get; set; }

    public DbSet<InStockVoucherDetail> inStockVoucherDetails { get; set; }

    public DbSet<OrderVoucher> orderVouchers { get; set; }
    public DbSet<OrderVoucherDetail> orderVoucherDetails { get; set; }

    public DbSet<OutStockVoucher> outStockVouchers { get; set; }
    public DbSet<OutStockVoucherDetail> outStockVoucherDetails { get; set; }

    public DbSet<PackVoucher> packVouchers { get; set; }

    public DbSet<PackVoucherDetail> packVoucherDetails { get; set; }    

    public DbSet<RegressionVoucher> regressionVouchers { get; set; }

    public DbSet<RegressionVoucherDetail> regressionVoucherDetails { get; set; }

    public DbSet<RejectStockVoucher> rejectStockVouchers{ get; set; }
    public DbSet<RejectStockVoucherDetail> rejectStockVoucherDetails{ get; set; }

    public DbSet<ReturnStockVoucher> returnStockVouchers { get; set; }
    public DbSet<ReturnStockVoucherDetail> returnStockVoucherDetails { get; set; }

    public DbSet<UnPackVoucher> unPackVouchers { get; set; }
    public DbSet<UnPackVoucherDetail> unPackVoucherDetails { get; set; }

    #endregion
    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        builder.ConfigureWms(options =>
        {
            options.TablePrefix = TablePrefix;
            options.Schema = Schema;
        });
    }


}
